fix(prefs): invalidate cached scope synchronously on setValue#9
Conversation
Dropping the cache from the shutdown-time store() path races SessionLifecycle::shutdown()'s mirror to $_SESSION: the mirror runs first, so the invalidation never reaches the persisted session row. Invalidate synchronously in setValue() so the removal is part of the mirrored payload. Refs horde/SessionHandler#13.
|
reviewed and approved, some hints: nosave option — Cache is invalidated even when nosave: true (e.g. IMP post-login overrides). That is probably fine: in-memory updates stay in $_scopes for the current object; nosave changes were never meant to survive anyway. Worth knowing if anyone relied on stale cache surviving a nosave write in the same request across multiple Horde_Prefs instances (unlikely). Exception type — Catches bare Exception, consistent with store() in the same class, not newer Horde_Exception style. Fine for this legacy file. No unit test — A small test with a cache stub recording remove() calls on setValue() would lock in the contract and guard against regressing back to shutdown-only invalidation. Not required to merge given the cross-package nature of the bug. FYI @ralflang |
Shutdown-time cache drop races SessionLifecycle::shutdown()'s mirror to $_SESSION and never reaches the persisted row. Invalidate in setValue() so the removal is part of the mirrored payload.
Depends on horde/Core PR fixing
Horde_Core_Cache_Session::expire()key mismatch to actually take effect.Refs horde/SessionHandler#13.